package com.sl.au.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.User;

import java.util.List;

public interface UserRepository extends JpaRepository<User, String> {
	@Query("select u from User u where u not in(select a.user from Account a )")
	List<User> findAccountIsNull();

	@Query("select u from User u where u.sex like %?1% or u.contactType like %?1% or u.name like %?1% ")
	Page<User> getUserName(String key, Pageable pageable);

	@Query("select u from User u where u.id " + "  not in( select a.user.id from Account a )")
	List<User> getNoAccount();

	User findByName(String name);

}
